// 也可以在package.json上加上   "proxy":"http://192.168.31.66:3000"
const {
  createProxyMiddleware
} = require('http-proxy-middleware');

module.exports = function (app) {
  app.use(
    // 配置多个跨域
    createProxyMiddleware("/api1", {
      target: "http://192.168.31.66:3000",
      changeOrigin: true, //修改服务器的host的值
      pathRewrite: { "^/api1": "" }, //重写请求路径
    }),
    createProxyMiddleware("/api2", {
      target: "http://192.168.31.66:8000",
      changeOrigin: true,
      pathRewrite: { "^/api2": "" },
    })
  )
}
